#coding=utf8
from django.db import models

# Create your models here.
class Location(models.Model):
    city = models.CharField('城市',max_length=50)
    state = models.CharField('省份',max_length=50, null=True, blank=True)
    country = models.CharField('国家',max_length=50)
    def __unicode__(self):
        if self.state:
            return "%s, %s, %s" % (self.city, self.state, self.country)
        else:
            return "%s, %s" % (self.city, self.country)
class Job(models.Model):
    pub_date = models.DateField('发布日期')
    job_title = models.CharField('职位',max_length=50)
    job_description = models.TextField('职位描述')
    location = models.ForeignKey(Location)
    def __unicode__(self):
        return "%s (%s)" % (self.job_title, self.location)

class Person(models.Model):
    name=models.CharField('Name',max_length=50)
    def __unicode__(self):
          return "%s" % (self.name)

class PersonJob(models.Model):
    job=models.ForeignKey(Job)
    person=models.ForeignKey(Person)
    def __unicode__(self):
           return ""
